package cn.tuling.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/i18n")
@RestController
public class I18NController {
    @Autowired
    ResourceBundleMessageSource messageSource;

    @GetMapping("/test")
    public String test() {
        int i = 1 / 0;
        return messageSource.getMessage("query.success", null, LocaleContextHolder.getLocale());
    }
}
